package com.rnd.kx.mvp.http.net;

import com.rnd.kx.mvp.bean.IndexBean;
import com.rnd.kx.mvp.bean.LoginBean;
import com.rnd.kx.mvp.bean.SearchBean;
import com.rnd.kx.mvp.http.bean.BaseObjectBean;
import com.rnd.kx.mvp.http.config.URLConfig;

import io.reactivex.Flowable;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;

public interface APIService {
    /**
     * 登陆
     *
     * @param username 账号
     * @param password 密码
     * @return
     */
    @FormUrlEncoded
    @POST("user/login")
    Flowable<BaseObjectBean<LoginBean>> login(@Field("username") String username,
                                              @Field("password") String password);

    //搜索
    @GET(URLConfig.search)
    Flowable<BaseObjectBean<SearchBean>> getSearch(@Query("keywords") String keywords);

    //首页
    @GET(URLConfig.index)
    Flowable<BaseObjectBean<IndexBean>> getIndex();
}
